package com.apes.framework.jpa.generator.repository;


import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.framework.jpa.generator.model.Sequence;
import com.apes.framework.jpa.generator.model.SequenceDateRange;

import java.util.Date;


/**
 * @author xul
 * @create 2018-01-23 16:07
 */
public interface SequenceDateRangeRepository extends CustomRepository<SequenceDateRange, Long> {

    SequenceDateRange findFirstBySequenceAndDateFromLessThanEqualAndDateToIsGreaterThanEqual(Sequence sequence, Date dateFrom, Date dateTo);

    SequenceDateRange findFirstBySequenceAndDateFromGreaterThanEqualAndDateFromLessThanEqualOrderByDateFromDesc(Sequence sequence, Date now, Date dateTo);

    SequenceDateRange findFirstBySequenceAndDateToGreaterThanEqualAndDateToLessThanEqualOrderByDateToDesc(Sequence sequence, Date dateFrom, Date now);

}
